<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>乐馆</title>
    <!-- Swiper CSS -->
    <link rel="stylesheet" href="./swiper-bundle.min.css" />
    <style>
        /* 页面样式 */
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f5f5f5;
            height: 1000px;
        }

        .header {
            display: flex;
            justify-content: space-around;
            align-items: center;
            background-color: #e8f5e9;
            padding: 10px;
        }
    

        .header div {
            font-size: 18px;
            font-weight: bold;
            cursor: pointer;
        }

        .search-bar {
            display: flex;
            justify-content: center;
            padding: 10px;
        }

        .search-bar input {
            width: 80%;
            padding: 8px;
            border-radius: 20px;
            border: 1px solid #ccc;
        }

        .content {
            padding: 20px;
        }

        /* Swiper styles */
        .swiper-container {
            position: relative;
            width: 100%;
            height: 30%;
            z-index: 1;
            display: flex;
            transition-property: transform;
            box-sizing: content-box;
            overflow: hidden;
           
        }

       

        .swiper-slide img {
            margin-left: 0;
            margin-right: 0;
            width: 100%;
            position: relative;
            overflow: hidden;
            list-style: none;
            padding: 0;
        z-index: 1;
    display: block;
        }
        .recommendation {
            margin-bottom: 20px;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
        }
        .recommendation img{
            width: 100px;
            height: 100px;
            margin-right: 10px;
        }

          /* 底部导航样式 */
          #bnav{
            /* 固定定位 左下角*/
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            
            z-index: 9;
            background-color: #e8f5e9; /* 导航背景颜色 */
            padding: 10px 0; /* 导航内边距 */
        }
        #bnav ul{
            display: flex;
        }
        #bnav li{
            width:20%;
            text-align: center;
        }
        #bnav svg{
            width: 24px; /* 调整SVG图标宽度 */
            height: 24px; /* 调整SVG图标高度 */
            margin: 5px auto; /* SVG图标外边距 */
        }
        #bnav p{
            font-size: 14px; /* 文字大小 */
            color: #333; /* 文字颜色 */
        }
        .icon-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
}

.icon-row ul {
    display: flex;
    flex-wrap: wrap; /* 允许列表换行 */
    /* 均分剩余空间 */
    justify-content: space-between;
    width: 100%;
}

.icon-row li {
    width: calc(25% - 10px); /* 减去间距，确保每行四个图标 */
    margin: 5px; /* 增加图标之间的间距 */
    text-align: center;
}

.icon-row svg {
    width: 24px; /* 调整SVG图标宽度 */
    height: 24px; /* 调整SVG图标高度 */
    margin: 5px auto; /* SVG图标外边距 */
}

.icon-row p {
    font-size: 14px; /* 文字大小 */
    color: #333; /* 文字颜色 */
    margin-top: 5px; /* 文字与图标之间的间距 */
}
    </style>
    <!-- 第一步：引入项目下面生成的 fontclass 代码： -->
    <script src="./font/iconfont.js"></script>
    <link rel="stylesheet" href="./pub.css">
    <script src="./font1/iconfont.js"></script>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="header">
        <a href="./index.html"><div>推荐</div></a>
        <div>乐馆</div>
        <div>助眠</div>
        <div>儿童</div>
        <div>会员</div>
        <div>金币</div>
    </div>

    <!-- 搜索栏 -->
    <div class="search-bar">
        <input type="text" placeholder="搜索音乐、歌手、专辑...">
    </div>

    <!-- Swiper -->
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide"><img src="./img/313.webp" alt="幻灯片1"></div>
            <div class="swiper-slide"><img src="./img/312.webp" alt="幻灯片2"></div>
            <div class="swiper-slide"><img src="./img/314.webp" alt="幻灯片2"></div>
            <div class="swiper-slide"><img src="./img/315.webp" alt="幻灯片2"></div>
            <!-- 更多幻灯片 -->
        </div>
        
        <div class="swiper-pagination"></div>
  
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
    </div>

<div class="icon-row">
    <ul>
        <li>
            <a href="#">
                <span>
                    <!-- SVG图标结构 -->
                    <svg class="icon1" aria-hidden="true">
                        <use xlink:href="#icon-ren"></use> 
                    </svg>
                </span>
                <p>歌手</p>
            </a>
        </li>
        <li>
            <a href="#">
                <span>
                    <!-- SVG图标结构 -->
                    <svg class="icon1" aria-hidden="true">
                        <use xlink:href="#icon-paixing"></use>
                    </svg>
                </span>
                <p>排行</p>
            </a>
        </li>
        
        <li>
            <a href="#">
                <span>
                    <!-- SVG图标结构 -->
                    <svg class="icon1" aria-hidden="true">
                        <use xlink:href="#icon-zuanshi"></use>
                    </svg>
                </span>
                <p>星光钻</p>
            </a>
        </li>
        <li>
            <a href="#">
                <span>
                    <!-- SVG图标结构 -->
                    <svg class="icon1" aria-hidden="true">
                        <use xlink:href="#icon-fenlei"></use>
                    </svg>
                </span>
                <p>分类</p>
            </a>
        </li>
        <li>
            <a href="#">
                <span>
                    <!-- SVG图标结构 -->
                    <svg class="icon1" aria-hidden="true">
                        <use xlink:href="#icon-shouyinji"></use>
                    </svg>
                </span>
                <p>音乐雷达</p>
            </a>
        </li>
        <li>
            <a href="#">
                <span>
                    <!-- SVG图标结构 -->
                    <svg class="icon1" aria-hidden="true">
                        <use xlink:href="#icon-cipanmeiti"></use>
                    </svg>
                </span>
                <p>数字专辑</p>
            </a>
        </li>
        <li>
            <a href="#">
                <span>
                    <!-- SVG图标结构 -->
                    <svg class="icon1" aria-hidden="true">
                        <use xlink:href="#icon-yinle"></use>
                    </svg>
                </span>
                <p>音乐魔法</p>
            </a>
        </li>
        <li>
            <a href="#">
                <span>
                    <!-- SVG图标结构 -->
                    <svg class="icon1" aria-hidden="true">
                        <use xlink:href="#icon-gangqin"></use>
                    </svg>
                </span>
                <p>古典焕新</p>
            </a>
        </li>
    </ul>
</div>
<h3>甄选内容</h3>
<div class="content">
    <div class="recommendation" id="recommendation">
       
        <!-- 推荐项内容将通过JavaScript动态生成 -->
    </div>
</div>

    <!-- 底部导航 -->
    <nav id="bnav">
        <ul>
            <li>
                <a href="./index.html">
                    <span>
                        <!-- SVG图标结构 -->
                        <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-QQyinle"></use>
                        </svg>
                    </span>
                    <p>首页</p>
                </a>
            </li>
            <li>
                <a href="./zhibo.html">
                    <span>
                        <!-- SVG图标结构 -->
                        <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-kejian"></use> 
                        </svg>
                    </span>
                    <p>直播</p>
                </a>
            </li>
            <li>
                <a href="./leida.html">
                    <span>
                        <!-- SVG图标结构 -->
                        <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-redian"></use>
                        </svg>
                    </span>
                    <p>雷达</p>
                </a>
            </li>
            <li>
                <a href="./shequ.html">
                    <span>
                        <!-- SVG图标结构 -->
                        <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-shequ"></use>
                        </svg>
                    </span>
                    <p>社区</p>
                </a>
            </li>
            <li>
                <a href="./wode.html">
                    <span>
                        <!-- SVG图标结构 -->
                        <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-wode"></use>
                        </svg>
                    </span>
                    <p>我的</p>
                </a>
            </li>
        </ul>
    </nav>
    <!-- Swiper JS -->
    <script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
    <script>
        var swiper = new Swiper('.swiper-container', {
            pagination: {
                el: '.swiper-pagination',
                clickable: true,
            },
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
            autoplay: {
                delay: 3000,
            },
        });
    </script>
    
    <script>
        var recommendationData = [
    {
        "img": "./img/317.webp",
        "des": "再见了《情书》"
    },
    {
        "img": "./img/316.webp",
        "des": "有哪些宝藏R&B神曲推荐"
    }
    
];

        var recommendation = document.getElementById('recommendation');

        recommendationData.forEach(function(item) {
            var recommendationItem = document.createElement('div');
            recommendationItem.className = 'recommendation-item';
            recommendationItem.innerHTML = `
                <img src="${item.img}" alt="${item.name}">
                <div class="text-overlay">
                    <p>${item.des}</p>
                </div>
            `;
            recommendation.appendChild(recommendationItem);
        });
         // 页面动态高亮顶部和底部导航
         const headerItems = document.querySelectorAll(".header div");
        const footerItems = document.querySelectorAll("#bnav li");

        headerItems.forEach(item => {
            item.addEventListener("click", () => {
                headerItems.forEach(i => i.style.color = "black");
                item.style.color = "green";
            });
        });

        footerItems.forEach(item => {
            item.addEventListener("click", () => {
                footerItems.forEach(i => {
                    i.querySelector('p').style.color = "black";
                });
                item.querySelector('p').style.color = "green";
            });
        });
    </script>
</body>
</html>